package com.letoken.platform.repo.app.mq.manager;

import com.alibaba.fastjson.JSONObject;
import com.letoken.platform.repo.app.dto.ImUserLoginDto;
import com.letoken.platform.repo.mq.constant.ImUserConstant;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

/**
 * @author wyl
 * @date 2023/2/20 11:13
 * @Version 1.0
 */
@Component
public class AppUserImMQManager {

    public void imLoginUser(RabbitTemplate rabbitTemplate, ImUserLoginDto dto){
        rabbitTemplate.convertAndSend(
                ImUserConstant.TOPIC_EXCHANGE_IM_USER_LOGIN,
                ImUserConstant.QUEUE_IM_USER_LOGIN,
                JSONObject.toJSON(dto).toString(),
                message -> {
//                    message.getMessageProperties().setExpiration(ms.toString());
                    return message;
                }
        );
    }
}
